package com.baor.order.service.impl;

import java.util.List;
import com.baor.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baor.order.mapper.TInvoiceMapper;
import com.baor.order.domain.TInvoice;
import com.baor.order.service.ITInvoiceService;

/**
 * 发票Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-18
 */
@Service
public class TInvoiceServiceImpl implements ITInvoiceService 
{
    @Autowired
    private TInvoiceMapper tInvoiceMapper;

    /**
     * 查询发票
     * 
     * @param invoiceId 发票主键
     * @return 发票
     */
    @Override
    public TInvoice selectTInvoiceByInvoiceId(Long invoiceId)
    {
        return tInvoiceMapper.selectTInvoiceByInvoiceId(invoiceId);
    }

    /**
     * 查询发票列表
     * 
     * @param tInvoice 发票
     * @return 发票
     */
    @Override
    public List<TInvoice> selectTInvoiceList(TInvoice tInvoice)
    {
        return tInvoiceMapper.selectTInvoiceList(tInvoice);
    }

    @Override
    public List<TInvoice> selectTInvoiceUnInvoicedList(TInvoice tInvoice) {
        return tInvoiceMapper.selectTInvoiceUnInvoicedList(tInvoice);
    }

    @Override
    public List<TInvoice> selectTInvoiceInvoicedList(TInvoice tInvoice) {
        return tInvoiceMapper.selectTInvoiceInvoicedList(tInvoice);
    }

    @Override
    public int updateTInvoiceStatus(TInvoice tInvoice) {
        return tInvoiceMapper.updateTInvoiceStatus(tInvoice);
    }

    /**
     * 新增发票
     * 
     * @param tInvoice 发票
     * @return 结果
     */
    @Override
    public int insertTInvoice(TInvoice tInvoice)
    {
        tInvoice.setCreateTime(DateUtils.getNowDate());
        return tInvoiceMapper.insertTInvoice(tInvoice);
    }

    /**
     * 修改发票
     * 
     * @param tInvoice 发票
     * @return 结果
     */
    @Override
    public int updateTInvoice(TInvoice tInvoice)
    {
        return tInvoiceMapper.updateTInvoice(tInvoice);
    }

    /**
     * 批量删除发票
     * 
     * @param invoiceIds 需要删除的发票主键
     * @return 结果
     */
    @Override
    public int deleteTInvoiceByInvoiceIds(Long[] invoiceIds)
    {
        return tInvoiceMapper.deleteTInvoiceByInvoiceIds(invoiceIds);
    }

    /**
     * 删除发票信息
     * 
     * @param invoiceId 发票主键
     * @return 结果
     */
    @Override
    public int deleteTInvoiceByInvoiceId(Long invoiceId)
    {
        return tInvoiceMapper.deleteTInvoiceByInvoiceId(invoiceId);
    }
}
